package com.example.rocketmqdemo.controller;

import com.example.rocketmqdemo.message.MyProducer1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessageController {
    @Autowired
    private MyProducer1 producer;

    @GetMapping("/sendMessage")
    public String sendMessage(@RequestParam("message") String message){
        producer.sendMessage("test-topic",message);
        return "success";
    }
}
